﻿
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel.Activation;
using System.ServiceModel;
using LightSO.Entity;
using LightSO.Business;
using LightSO.Extensions;


namespace LightSO.Model
{
	/// <summary>
	/// FAQ
	/// </summary>
	[DataContract]
	[ServiceContract]
	[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
	public  partial class FAQ  : EntityBase
	{
		public FAQ()
		{
			entity = new Entity.FAQ();
		}
		public FAQ(Entity.FAQ info)
		{
			entity = info;
		}
		private Entity.FAQ entity = null;
		new internal Entity.FAQ ToEntity()
		{
			return entity;
		}
		[DataMember]
		public long Id
		{
			get { return entity.Id; }
			set { entity.Id = value; }
		}
		[DataMember]
		public int Type
		{
			get { return entity.Type; }
			set { entity.Type = value; }
		}
		[DataMember]
		public string Content
		{
			get { return entity.Content; }
			set { entity.Content = value; }
		}
		[DataMember]
		public long ParentId
		{
			get { return entity.ParentId; }
			set { entity.ParentId = value; }
		}
		[DataMember]
		public long CatalogId
		{
			get { return entity.CatalogId; }
			set { entity.CatalogId = value; }
		}
		[DataMember]
		public DateTime CreateOn
		{
			get { return entity.CreateOn; }
			set { entity.CreateOn = value; }
		}
		[DataMember]
		public long Sort
		{
			get { return entity.Sort; }
			set { entity.Sort = value; }
		}

        [OperationContract]
        [System.ServiceModel.Web.WebInvoke(
			Method = "POST", 
			ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, 
			BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest
        )]
        public FAQ Get(int id)
        {
			var entites = (new FAQBll()).Get(id);
			var models = entites.ConvertTo<Entity.FAQ, FAQ>();

			return models;
        }

        [OperationContract]
        [System.ServiceModel.Web.WebInvoke(
			Method = "POST", 
			ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, 
			BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest
        )]
        public void Save(FAQ info)
        {
			(new FAQBll()).Save(info.ToEntity());
        }

        [OperationContract]
        [System.ServiceModel.Web.WebInvoke(
			Method = "POST", 
			ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, 
			BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest
        )]
        public void Remove(int id)
        {
			(new FAQBll()).Remove(id);
        }

        [OperationContract]
        [System.ServiceModel.Web.WebInvoke(
			Method = "POST", 
			ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, 
			BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest
        )]
        public List<FAQ> Page(string pageIndex, string pageSize, string sort)
        {
			var entites = (new FAQBll()).Page(pageIndex,pageSize,sort);
			var models = entites.ConvertTo<List<Entity.FAQ>, List<FAQ>>();

			return models;
        }

        [OperationContract]
        [System.ServiceModel.Web.WebInvoke(
			Method = "POST", 
			ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, 
			BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest
        )]
        public List<FAQ> List(string sort)
        {
			var entites = (new FAQBll()).List(sort);
			var models = entites.ConvertTo<List<Entity.FAQ>, List<FAQ>>();

			return models;
        }

        [OperationContract]
        [System.ServiceModel.Web.WebInvoke(
			Method = "POST", 
			ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, 
			BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest
        )]
        public List<FAQ> Find(string keyword)
        {
			var entites = (new FAQBll()).Find(keyword);
			var models = entites.ConvertTo<List<Entity.FAQ>, List<FAQ>>();

			return models;
        }

	}
} 


